Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: remove _closed #6574

Closed
wants to merge 2 commits into from
Closed

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented May 4, 2016

Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

zlib

Description of change

This is purely cleanup and carries no visible behavioural changes.
Up to now, this._closed was used in zlib.js as a synonym of !this._handle. This change makes this connection explicit and removes the _closed property from zlib streams, as the previous duplication has been the cause of subtle errors like #6034.

This also makes zlib errors lead to an explicit _close() call rather than waiting for garbage collection to clean up the handle, thus returning memory resources earlier in the case of an error.

CI: https://ci.nodejs.org/job/node-test-commit/3184/

This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like nodejs#6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.
@addaleax addaleax added the zlib Issues and PRs related to the zlib subsystem. label May 4, 2016
@cjihrig
Copy link
Contributor

cjihrig commented May 4, 2016

Even though this was an underscored property, it should probably still go through a deprecation cycle.

@Fishrock123 Fishrock123 added the semver-major PRs that contain breaking changes and should be released in the next major version. label May 4, 2016
@Trott
Copy link
Member

Trott commented May 4, 2016

You can de-semver-major-ize this PR by keeping ._closed but just not actually using it.

A separate PR can remove it (or print a deprecation warning if it's accessed, or whatever the correct first deprecation step is in this situation).

@addaleax
Copy link
Member Author

addaleax commented May 4, 2016

Eh, yes, I’m adding a getter for _closed then.

Add a getter for `_closed` so that the property remains accessible
by legacy code.
@addaleax
Copy link
Member Author

addaleax commented May 4, 2016

Done. The OS X CI failure looks very unrelated, but I don’t recall it being mentioned as flaky anywhere, if anyone’s curious.

@addaleax addaleax removed the semver-major PRs that contain breaking changes and should be released in the next major version. label May 4, 2016
@Trott
Copy link
Member

Trott commented May 4, 2016

OS X thing sure looks unrelated. Maybe run a second CI just to make sure? Stranger things have happened, although not often. :-)

@addaleax
Copy link
Member Author

addaleax commented May 4, 2016

@cjihrig
Copy link
Contributor

cjihrig commented May 4, 2016

LGTM if the CI is happy.

@jasnell
Copy link
Member

jasnell commented May 6, 2016

LGTM but if you happen to know of any modules that use zlib we may want to get those into citgm to make sure these kinds of changes don't have unintended drawbacks /cc @thealphanerd

@addaleax
Copy link
Member Author

addaleax commented May 8, 2016

Hmm… there are

each with > 500k npm downloads/month, I think that’s something?

@jasnell
Copy link
Member

jasnell commented May 8, 2016

Works for me!

@addaleax
Copy link
Member Author

I think this can be landed without an extra citgm run, but ping @thealphanerd … interested in adding the modules from above to the list?

@MylesBorins
Copy link
Contributor

MylesBorins commented May 11, 2016 via email

@addaleax
Copy link
Member Author

Oh, okay then, sorry for bothering. ;-)

@MylesBorins
Copy link
Contributor

MylesBorins commented May 11, 2016 via email

@addaleax
Copy link
Member Author

Landed in b53473f

@addaleax addaleax closed this May 17, 2016
@addaleax addaleax deleted the zlib-remove-_closed branch May 17, 2016 21:29
addaleax added a commit that referenced this pull request May 17, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fishrock123 pushed a commit that referenced this pull request May 23, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

@addaleax lts?

rvagg pushed a commit that referenced this pull request Jun 2, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants